<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of class
 *
 * @author ������
 */
abstract class Model implements IObservable{
    private $pageName = 'std page';
    
    public function setPageName($pageName) {
        $this->pageName = $pageName;
    }
    public function getPageName() {
        return $this->pageName;
    }
    protected $registry;
    private $observers;
    public function __get($key) {
        return $this->registry->get($key);
    }

    public function __set($key, $value) {
        $this->registry->set($key, $value);
    }
    public function __construct() {
         $this->registry = Registry::getInstance();
    }

    public function addObserver(IObserver $objObserver) {
        $this->observers[] = $objObserver;
    }

    public function fireEvent($eventType, $data) {
        foreach ($this->observers as $observer) {
            $observer->notify($eventType, $data);
        }
    }

    protected function dump($param) {
        echo"<pre>";
        var_dump($param);
        echo"</pre>";
    }

}
?>
